from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *

def display():
    glClear(GL_COLOR_BUFFER_BIT)
    glColor3f(1.0, 0.0, 0.0)  # 设置颜色为红色
    glBegin(GL_QUADS)  # 开始四边形
    glVertex3f(-0.5, -0.5, 0.0)  # 左下角
    glVertex3f(0.5, -0.5, 0.0)  # 右下角
    glVertex3f(0.5, 0.5, 0.0)   # 右上角
    glVertex3f(-0.5, 0.5, 0.0)  # 左上角
    glEnd()
    glutSwapBuffers()

glutInit(sys.argv)
glutCreateWindow(b"PyOpenGL Example")
glutDisplayFunc(display)
glutMainLoop()